<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 500px;
            height: 500px;
            background-color: #f00;
        }

        h1 {
            /* 消除指向事件  --- 禁用鼠标事件，包括hover */
            pointer-events: none;
            background-color: #ff0;
            width: 100px;
            margin-left: 50px;
        }

        h1:hover {
            color: red;
        }
    </style>
</head>

<body>

    <div class="box">
        <h1>111</h1>
    </div>

    <script>

        // pointer-events : none     除指向事件  --- 禁用鼠标事件，包括hover


        // 可以在鼠标跟随的时候使用


        var oDiv = document.querySelector('.box');

        oDiv.onclick = function (e) {
            // alert(666)
            console.log(e.offsetX);
        }
    </script>

</body>

</html>